home *** CD-ROM | disk | FTP | other *** search
- Subject: v17i064: Zoo archive program, Part01/10
- Newsgroups: comp.sources.unix
- Approved: rsalz@uunet.UU.NET
-
- Submitted-by: Rahul Dhesi <bsu-cs!dhesi@iuvax.cs.indiana.edu>
- Posting-number: Volume 17, Issue 64
- Archive-name: zoo2/part01
-
- The zoo archive program maintains archives of files in compressed
- form. Subdirectory structure can be preserved across dissimilar
- systems. Timezone and file attributes can be preserved. Multiple
- generations of the same file can be stored, and the user may specify
- how many generations of a file should be kept. A comment may be
- attached to each archived file or to the archive as a whole. Filenames
- to be archived may be fed from standard input or supplied as
- arguments.
-
- This is a posting of the (relatively) portable C source for version
- 2.01. It is ready for compilation under VAX/VMS 4.6, 4.3BSD, Xenix,
- System V Release 2 (including Microport System V/AT), and other similar
- systems. A system-dependent support package, which will allow this
- present source posting to be compiled under MS-DOS, will be posted to
- comp.binaries.ibm.pc separately. Binaries for AmigaDOS and MS-DOS,
- have appeared or will appear in appropriate newsgroups. A small,
- memory-efficient zoo archive extractor called "booz" has already
- appeared in comp.sources.misc.
-
- Rahul Dhesi UUCP: <backbones>!{iuvax,pur-ee,uunet}!bsu-cs!dhesi
-
- #! /bin/sh
- # This is a shell archive. Remove anything before this line, then unpack
- # it by saving it into a file and typing "sh file". To overwrite existing
- # files, type "sh file -c". You can also feed this as standard input via
- # unshar, or by typing "sh <file", e.g.. If this archive is complete, you
- # will see the following message at the end:
- # "End of archive 1 (of 10)."
- # Wrapped by rsalz@papaya.bbn.com on Thu Feb 2 18:03:55 1989
- PATH=/bin:/usr/bin:/usr/ucb ; export PATH
- if test -f 'Changes' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'Changes'\"
- else
- echo shar: Extracting \"'Changes'\" \(2497 characters\)
- sed "s/^X//" >'Changes' <<'END_OF_FILE'
- X
- X
- X CHANGES
- X
- X
- XSummary of Changes from Zoo version 1.51 to version 2.0.
- X
- X - New modifiers to the list commands permit several new output
- X formats.
- X
- X - Timezones are handled.
- X
- X - A bug was fixed that had made it impossible to individually update
- X comments for a file whose name did not correspond to MS-DOS format.
- X
- X - The shared library on the **IX PC can be used.
- X
- X - VAX/VMS is now supported reasonably well.
- X
- X - A comment may now be attached to the archive itself.
- X
- X - Extracted files can optionally be forced to overwrite existing
- X read-only files.
- X
- X - Extracted files will not overwrite newer existing files unless
- X specifically requested.
- X
- X - File attributes (lowest nine mode bits) are preserved for **IX
- X systems.
- X
- X - Multiple generations of the same file are supported.
- X
- X - Zoo will now act as a pure compression or uncompression filter on a
- X single input data stream.
- X
- X - A bug was fixed that could cause removal of a directory link by the
- X superuser.
- X
- X - The ability of Zoo to recover data from damaged archives is greatly
- X improved.
- X
- X
- XSummary of Changes from Zoo version 2.00 to version 2.01.
- X
- X - A bug was fixed that had caused the first generation of a file to
- X sometimes unexpectedly show up in archive listings.
- X
- X - A bug was fixed that had caused the MS-DOS version to silently skip
- X extracting files for which there was not sufficient disk space; an
- X error message will now be given.
- X
- X - A bug was fixed that had sometimes made it impossible to
- X selectively extract a file by specifying its name, even though all
- X files could be extracted from the archive by not specifying any
- X filenames. This occurred when a file had been archived on a
- X longer-filename system (e.g. AmigaDOS) and extraction was attempted
- X on a shorter-filename system (e.g. MS-DOS).
- X
- X - A change was made that will make zoo preserve the mode (file
- X protection) of a zoo archive when it is packed. This is effective
- X only if zoo is compiled to preserve and restore file attributes.
- X Currently this is so only for **IX systems.
- X
- X - A bug was fixed that had caused an update of an archive to not
- X always add all newer files.
- X
- X - Blanks around equal signs in commands given to "make" were removed
- X from the mk* scripts for better compatiblity with more **IX
- X implementations including Sun's.
- X
- X -- Rahul Dhesi 1988/08/25
- END_OF_FILE
- if test 2497 -ne `wc -c <'Changes'`; then
- echo shar: \"'Changes'\" unpacked with wrong size!
- fi
- # end of 'Changes'
- fi
- if test -f 'Latenews' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'Latenews'\"
- else
- echo shar: Extracting \"'Latenews'\" \(1207 characters\)
- sed "s/^X//" >'Latenews' <<'END_OF_FILE'
- X Late breaking comments
- X
- Xo I have not tried compiling and executing all source files with NDEBUG
- X *not* defined. When NDEBUG is not defined, many assertions in the code
- X get enabled and will give error messages if they fail. Recent
- X revisions may have made some of these assertions invalid.
- X
- Xo On systems with ints longer than 32 bits, there were some minor
- X portability problems reported in the past. I suggested some fixes (which
- X are incorporated in the current distribution) but was unable to confirm
- X if they worked. If you get zoo 2.0 working on a Cray, CDC, or similar
- X machine with very large ints, please let me know.
- X
- Xo Handling of pathnames longer than 255 characters is probably not robust
- X at this time. Zoo should be able to handle pathanmes of up to 510
- X characters, with the filename part and the directory prefix part each
- X being 255 characters or less. But it will probably choke on any pathname
- X that is longer than 255 characters.
- X
- Xo The **IX "file" command, at least on System V Release 2 and on 4.3BSD,
- X can be made to recognize zoo archives. Instructions are in the file
- X "file.fix".
- END_OF_FILE
- if test 1207 -ne `wc -c <'Latenews'`; then
- echo shar: \"'Latenews'\" unpacked with wrong size!
- fi
- # end of 'Latenews'
- fi
- if test -f 'addbfcrc.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'addbfcrc.c'\"
- else
- echo shar: Extracting \"'addbfcrc.c'\" \(852 characters\)
- sed "s/^X//" >'addbfcrc.c' <<'END_OF_FILE'
- X#ifndef LINT
- Xstatic char sccsid[]="@(#) addbfcrc.c 2.2 88/01/29 17:04:31";
- X#endif /* LINT */
- X
- X#include "options.h"
- X/*
- Xaddbfcrc() accepts a buffer address and a count and adds the CRC for
- Xall bytes in the buffer to the global variable crccode using
- XCRC-16.
- X
- XCRC computation algorithm originally from an article by David Schwaderer
- Xin the April 1985 issue of PC Tech Journal.
- X
- XLoop optimization done by J. Brian Waters.
- X
- XI claim no copyright over the contents of this file.
- X
- X -- Rahul Dhesi 1986/08/27
- X
- X*/
- X
- Xextern unsigned int crccode;
- Xextern unsigned crctab[];
- X
- Xvoid addbfcrc(buffer,count)
- Xregister char *buffer;
- Xregister int count;
- X
- X{
- X register unsigned int localcrc;
- X localcrc = crccode;
- X
- X for (; count--; )
- X localcrc = (localcrc>>8) ^ crctab[(localcrc ^ (*buffer++)) & 0x00ff];
- X crccode = localcrc;
- X}
- END_OF_FILE
- if test 852 -ne `wc -c <'addbfcrc.c'`; then
- echo shar: \"'addbfcrc.c'\" unpacked with wrong size!
- fi
- # end of 'addbfcrc.c'
- fi
- if test -f 'assert.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'assert.h'\"
- else
- echo shar: Extracting \"'assert.h'\" \(1341 characters\)
- sed "s/^X//" >'assert.h' <<'END_OF_FILE'
- X/* @(#) assert.h 2.1 87/12/25 12:21:32 */
- X
- X/*
- XThe contents of this file are hereby released to the public domain.
- X
- X -- Rahul Dhesi 1986/11/14
- X
- XDefines a macro assert() that causes an assertion error if the assertion
- Xfails. For some useful information about this see "Reliable Data
- XStructures in C" by Thomas Plum page 1-21.
- X
- XConditional compilation:
- X
- X If NDEBUG is defined then
- X assert() is defined as null so all assertions vanish
- X else
- X if DUMB_ASS is defined then -- use dumb assertions
- X assertions print a message but not the filename and line number
- X else
- X assertions print message including filename and line number
- X endif
- X endif
- X
- XNote:
- X DUMB_ASS should be defined if the preprocessor does not support the
- X varying constants __FILE__ and __LINE__, which are supposed to hold the
- X name of the current file and the number of the current line.
- X
- X*/
- X
- X#ifndef NDEBUG
- X/* assert() macro defined only if NDEBUG is undefined */
- X#ifdef DUMB_ASS
- X#define assert(E) \
- X { if (!(E)) \
- X prterror ('w', "Assertion error.\n"); \
- X }
- X#else
- X/* else not DUMB_ASS */
- X#define assert(E) \
- X { if (!(E)) \
- X prterror ('w',"Assertion error in %s:%d.\n", __FILE__, __LINE__); \
- X }
- X#endif /* not DUMB_ASS */
- X#else
- X/* else NDEBUG */
- X#define assert(E)
- X#endif /* NDEBUG */
- END_OF_FILE
- if test 1341 -ne `wc -c <'assert.h'`; then
- echo shar: \"'assert.h'\" unpacked with wrong size!
- fi
- # end of 'assert.h'
- fi
- if test -f 'bsd.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'bsd.c'\"
- else
- echo shar: Extracting \"'bsd.c'\" \(2377 characters\)
- sed "s/^X//" >'bsd.c' <<'END_OF_FILE'
- X#ifndef LINT
- Xstatic char bsdid[]="@(#) bsd.c 2.3 88/01/10 14:45:19";
- X#endif /* LINT */
- X
- X/* machine.c for 4.3BSD. */
- X
- X/*
- XThe contents of this file are hereby released to the public domain.
- X
- X -- Rahul Dhesi 1987/07/23
- X*/
- X
- X/*
- XWARNING: This file assumes that ZOOFILE is a standard buffered
- Xfile. It will have to be modified if ZOOFILE is changed to
- Xbe an unbuffered file descriptor or to any other kind of file.
- X*/
- X
- X#ifdef UNBUF_IO
- X/*
- XFunction tell() returns the current seek position for a file
- Xdescriptor. 4.3BSD on VAX-11/785 has an undocumented tell() function
- Xbut it may not exist on all implementations, so we code one here
- Xto be on the safe side. It is needed for unbuffered I/O only.
- X*/
- Xlong lseek PARMS ((int, long, int));
- Xlong tell (fd)
- Xint fd;
- X{ return (lseek (fd, 0L, 1)); }
- X#endif
- X
- Xlong ftell();
- X
- X/****************
- XFunction trunc() truncates a file.
- X*/
- X
- Xint trunc (f)
- XZOOFILE f;
- X{
- X fflush (f); /* just in case it matters */
- X ftruncate (fileno (f), ftell (f));
- X}
- X
- X/****************
- XFunction fixfname() converts the supplied filename to a syntax
- Xlegal for the host system. It is used during extraction.
- X*/
- X
- Xchar *fixfname(fname)
- Xchar *fname;
- X{
- X return (fname); /* default is no-op */
- X}
- X
- X/****************
- XDate and time functions are standard UNIX-style functions. "nixtime.i"
- Xwill be included by machine.c.
- X*/
- X
- X#include <sys/types.h>
- X#include <sys/stat.h>
- X#include <sys/time.h>
- X
- X/* Function isadir() returns 1 if the supplied handle is a directory,
- Xelse it returns 0.
- X*/
- X
- Xint isadir (f)
- XZOOFILE f;
- X{
- X struct stat buf; /* buffer to hold file information */
- X if (fstat (fileno (f), &buf) == -1) {
- X return (0); /* inaccessible -- assume not dir */
- X } else {
- X if (buf.st_mode & S_IFDIR)
- X return (1);
- X else
- X return (0);
- X }
- X}
- X
- X/* Function gettz(), returns the offset from GMT in seconds */
- Xlong gettz()
- X{
- X struct timeval tp;
- X struct timezone tzp;
- X gettimeofday (&tp, &tzp); /* specific to 4.3BSD */
- X
- X /* return (tzp.tz_minuteswest * 60); */ /* old incorrect code */
- X /* Timezone fix thanks to Bill Davidsen <wedu@ge-crd.ARPA> */
- X return (tzp.tz_minuteswest * 60 - tzp.tz_dsttime * 3600L);
- X}
- X
- X/* Standard UNIX-compatible time routines */
- X#include "nixtime.i"
- X
- X/* Standard UNIX-specific file attribute routines */
- X#include "nixmode.i"
- END_OF_FILE
- if test 2377 -ne `wc -c <'bsd.c'`; then
- echo shar: \"'bsd.c'\" unpacked with wrong size!
- fi
- # end of 'bsd.c'
- fi
- if test -f 'crcdefs.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'crcdefs.c'\"
- else
- echo shar: Extracting \"'crcdefs.c'\" \(2446 characters\)
- sed "s/^X//" >'crcdefs.c' <<'END_OF_FILE'
- X#ifndef LINT
- Xstatic char sccsid[]="@(#) crcdefs.c 2.1 87/12/25 12:21:58";
- X#endif /* LINT */
- X
- X#include "options.h"
- X
- X/*
- XGlobal definitions for CRC calculation. I claim no copyright over
- Xthe contents of this file.
- X
- X -- Rahul Dhesi 1987/08/27
- X*/
- X
- Xunsigned int crccode;
- Xunsigned int crctab[] = {
- X 0x0000, 0xc0c1, 0xc181, 0x0140, 0xc301, 0x03c0, 0x0280, 0xc241,
- X 0xc601, 0x06c0, 0x0780, 0xc741, 0x0500, 0xc5c1, 0xc481, 0x0440,
- X 0xcc01, 0x0cc0, 0x0d80, 0xcd41, 0x0F00, 0xcFc1, 0xce81, 0x0e40,
- X 0x0a00, 0xcac1, 0xcb81, 0x0b40, 0xc901, 0x09c0, 0x0880, 0xc841,
- X 0xd801, 0x18c0, 0x1980, 0xd941, 0x1b00, 0xdbc1, 0xda81, 0x1a40,
- X 0x1e00, 0xdec1, 0xdF81, 0x1F40, 0xdd01, 0x1dc0, 0x1c80, 0xdc41,
- X 0x1400, 0xd4c1, 0xd581, 0x1540, 0xd701, 0x17c0, 0x1680, 0xd641,
- X 0xd201, 0x12c0, 0x1380, 0xd341, 0x1100, 0xd1c1, 0xd081, 0x1040,
- X 0xF001, 0x30c0, 0x3180, 0xF141, 0x3300, 0xF3c1, 0xF281, 0x3240,
- X 0x3600, 0xF6c1, 0xF781, 0x3740, 0xF501, 0x35c0, 0x3480, 0xF441,
- X 0x3c00, 0xFcc1, 0xFd81, 0x3d40, 0xFF01, 0x3Fc0, 0x3e80, 0xFe41,
- X 0xFa01, 0x3ac0, 0x3b80, 0xFb41, 0x3900, 0xF9c1, 0xF881, 0x3840,
- X 0x2800, 0xe8c1, 0xe981, 0x2940, 0xeb01, 0x2bc0, 0x2a80, 0xea41,
- X 0xee01, 0x2ec0, 0x2F80, 0xeF41, 0x2d00, 0xedc1, 0xec81, 0x2c40,
- X 0xe401, 0x24c0, 0x2580, 0xe541, 0x2700, 0xe7c1, 0xe681, 0x2640,
- X 0x2200, 0xe2c1, 0xe381, 0x2340, 0xe101, 0x21c0, 0x2080, 0xe041,
- X 0xa001, 0x60c0, 0x6180, 0xa141, 0x6300, 0xa3c1, 0xa281, 0x6240,
- X 0x6600, 0xa6c1, 0xa781, 0x6740, 0xa501, 0x65c0, 0x6480, 0xa441,
- X 0x6c00, 0xacc1, 0xad81, 0x6d40, 0xaF01, 0x6Fc0, 0x6e80, 0xae41,
- X 0xaa01, 0x6ac0, 0x6b80, 0xab41, 0x6900, 0xa9c1, 0xa881, 0x6840,
- X 0x7800, 0xb8c1, 0xb981, 0x7940, 0xbb01, 0x7bc0, 0x7a80, 0xba41,
- X 0xbe01, 0x7ec0, 0x7F80, 0xbF41, 0x7d00, 0xbdc1, 0xbc81, 0x7c40,
- X 0xb401, 0x74c0, 0x7580, 0xb541, 0x7700, 0xb7c1, 0xb681, 0x7640,
- X 0x7200, 0xb2c1, 0xb381, 0x7340, 0xb101, 0x71c0, 0x7080, 0xb041,
- X 0x5000, 0x90c1, 0x9181, 0x5140, 0x9301, 0x53c0, 0x5280, 0x9241,
- X 0x9601, 0x56c0, 0x5780, 0x9741, 0x5500, 0x95c1, 0x9481, 0x5440,
- X 0x9c01, 0x5cc0, 0x5d80, 0x9d41, 0x5F00, 0x9Fc1, 0x9e81, 0x5e40,
- X 0x5a00, 0x9ac1, 0x9b81, 0x5b40, 0x9901, 0x59c0, 0x5880, 0x9841,
- X 0x8801, 0x48c0, 0x4980, 0x8941, 0x4b00, 0x8bc1, 0x8a81, 0x4a40,
- X 0x4e00, 0x8ec1, 0x8F81, 0x4F40, 0x8d01, 0x4dc0, 0x4c80, 0x8c41,
- X 0x4400, 0x84c1, 0x8581, 0x4540, 0x8701, 0x47c0, 0x4680, 0x8641,
- X 0x8201, 0x42c0, 0x4380, 0x8341, 0x4100, 0x81c1, 0x8081, 0x4040
- X};
- END_OF_FILE
- if test 2446 -ne `wc -c <'crcdefs.c'`; then
- echo shar: \"'crcdefs.c'\" unpacked with wrong size!
- fi
- # end of 'crcdefs.c'
- fi
- if test -f 'debug.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'debug.h'\"
- else
- echo shar: Extracting \"'debug.h'\" \(615 characters\)
- sed "s/^X//" >'debug.h' <<'END_OF_FILE'
- X/* @(#) debug.h 2.1 87/12/25 12:22:02 */
- X
- X/*
- XThe contents of this file are hereby released to the public domain.
- X
- X -- Rahul Dhesi 1986/11/14
- X
- Xdefines conditional function calls
- X
- XUsage: The statement
- X
- X debug((printf("y = %d\n", y)))
- X
- Xmay be placed anywhere where two or more statements could be used. It will
- Xprint the value of y at that point.
- X
- XConditional compilation:
- X
- X if DEBUG is defined
- X define the macro debug(X) to execute statement X
- X else
- X define the macro debug(X) to be null
- X endif
- X*/
- X
- X#ifdef DEBUG
- X#define debug(x) x;
- X#else
- X#define debug(x)
- X#endif
- X
- END_OF_FILE
- if test 615 -ne `wc -c <'debug.h'`; then
- echo shar: \"'debug.h'\" unpacked with wrong size!
- fi
- # end of 'debug.h'
- fi
- if test -f 'descrip.mms' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'descrip.mms'\"
- else
- echo shar: Extracting \"'descrip.mms'\" \(2248 characters\)
- sed "s/^X//" >'descrip.mms' <<'END_OF_FILE'
- X# @(#) descrip.mms 2.2 88/01/09 12:10:49
- X#Make Zoo for VAX/VMS
- X#
- X#The contents of this makefile are hereby released to the public domain.
- X# -- Rahul Dhesi 1987/07/23
- X
- XCC = cc
- Xcswitch =
- Xextra = /define=(BIG_MEM,NDEBUG,VMS)
- Xldswitch =
- X
- X#List of all object files created for Zoo
- XZOOOBJS = addbfcrc.obj, addfname.obj, basename.obj, comment.obj, -
- X crcdefs.obj, getfile.obj, lzc.obj, lzd.obj, machine.obj, -
- X makelist.obj, misc.obj, misc2.obj, nextfile.obj, -
- X needed.obj, options.obj, parse.obj, portable.obj, prterror.obj, -
- X version.obj, zoo.obj, zooadd.obj, zooadd2.obj, zoodel.obj, -
- X zooext.obj, zoolist.obj, zoopack.obj
- X
- XFIZOBJS = fiz.obj, addbfcrc.obj, portable.obj, crcdefs.obj
- X
- X.c.obj :
- X $(CC) $(cswitch) $(extra) $*.c
- X
- Xzoo.exe : $(ZOOOBJS)
- X link/executable=zoo.exe $(ldswitch) $(ZOOOBJS), options/opt
- X
- X#bigger but more portable across machines -- no shared libraries
- Xzoobig.exe : $(ZOOOBJS)
- X link/executable=zoobig.exe $(ldswitch) $(ZOOOBJS)
- X
- Xfiz : $(FIZOBJS)
- X link/executable=fiz.exe $(ldswitch) $(FIZOBJS), options/opt
- X
- Xlzd.obj : lzd.c zoomem.h
- X $(CC) $(cswitch) $(extra) $*.c
- X
- Xlzc.obj : lzc.c zoomem.h
- X $(CC) $(cswitch) $(extra) $*.c
- X
- Xaddbfcrc.obj : addbfcrc.c
- X
- Xaddfname.obj : addfname.c
- X
- Xbasename.obj : basename.c
- X
- Xcomment.obj : comment.c zooio.h
- X $(CC) $(cswitch) $(extra) $*.c
- X
- Xcrcdefs.obj : crcdefs.c
- X
- Xgetfile.obj : getfile.c zoomem.h
- X $(CC) $(cswitch) $(extra) $*.c
- X
- Xmachine.obj : machine.c nixtime.i vms.c
- X $(CC) $(cswitch) $(extra) $*.c
- X
- Xmakelist.obj : makelist.c
- X
- Xmisc.obj : misc.c zooio.h
- X $(CC) $(cswitch) $(extra) $*.c
- X
- Xmisc2.obj : misc2.c zoomem.h
- X $(CC) $(cswitch) $(extra) $*.c
- X
- Xoptions.obj : options.c
- X
- Xnextfile.obj : nextfile.c
- X
- Xneeded.obj : needed.c
- X
- Xparse.obj : parse.c
- X
- Xportable.obj : portable.c
- X
- Xprterror.obj : prterror.c
- X
- Xzoo.obj : zoo.c zoomem.h errors.i
- X $(CC) $(cswitch) $(extra) $*.c
- X
- Xzooadd.obj : zooio.h zooadd.c
- X $(CC) $(cswitch) $(extra) $*.c
- X
- Xzooadd2.obj : zooio.h zooadd2.c
- X $(CC) $(cswitch) $(extra) $*.c
- X
- Xzoodel.obj : zooio.h zoodel.c
- X $(CC) $(cswitch) $(extra) $*.c
- X
- Xzooext.obj : zooext.c errors.i zooio.h
- X $(CC) $(cswitch) $(extra) $*.c
- X
- Xzoolist.obj : zooio.h zoolist.c
- X $(CC) $(cswitch) $(extra) $*.c
- X
- Xzoopack.obj : zooio.h zoopack.c
- X $(CC) $(cswitch) $(extra) $*.c
- END_OF_FILE
- if test 2248 -ne `wc -c <'descrip.mms'`; then
- echo shar: \"'descrip.mms'\" unpacked with wrong size!
- fi
- # end of 'descrip.mms'
- fi
- if test -f 'errors.i' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'errors.i'\"
- else
- echo shar: Extracting \"'errors.i'\" \(825 characters\)
- sed "s/^X//" >'errors.i' <<'END_OF_FILE'
- X/* @(#) errors.i 2.4 88/01/31 12:32:46 */
- X
- X/*
- XThe contents of this file are hereby released to the public domain.
- X
- X -- Rahul Dhesi 1986/11/14
- X*/
- X
- X/* defines all the errors as externs. Declarations must be
- Xequivalent to those in prterror.c */
- X
- X/* These declarations must be equivalent to those in prterror.c */
- Xextern char no_match[];
- Xextern char failed_consistency[];
- Xextern char invalid_header[];
- Xextern char internal_error[];
- Xextern char disk_full[];
- Xextern char bad_directory[];
- Xextern char no_memory[];
- Xextern char too_many_files[];
- Xextern char packfirst[];
- Xextern char garbled[];
- Xextern char start_ofs[];
- X
- X#ifndef OOZ
- Xextern char wrong_version[];
- Xextern char cant_process[];
- Xextern char option_ignored[];
- Xextern char inv_option[];
- Xextern char bad_crc[];
- X#endif
- X
- Xextern char could_not_open[];
- X
- END_OF_FILE
- if test 825 -ne `wc -c <'errors.i'`; then
- echo shar: \"'errors.i'\" unpacked with wrong size!
- fi
- # end of 'errors.i'
- fi
- if test -f 'file.fix' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'file.fix'\"
- else
- echo shar: Extracting \"'file.fix'\" \(1814 characters\)
- sed "s/^X//" >'file.fix' <<'END_OF_FILE'
- X Making the "file" command recognize zoo archives
- X
- XZoo archives have the following magic number: Beginning at offset 20
- Xdecimal, there are four bytes with the values 0xdc, 0xa7, 0xc4, and
- X0xfd. (But if you call the first byte of a zoo archive byte 1, then
- Xthe magic bytes will be bytes 21 through 24.)
- X
- XTo make the "file" command identify zoo archives, changes can be made
- Xas follows.
- X
- X4.3BSD: See the context diff near the end of this document, suitable
- Xfor application with the "patch" utility, that works with the 4.3BSD
- X"file" command on a VAX-11/785. I don't know if this will also work
- Xunder 4.2BSD or with any other implementation of the "file" command
- Xor on any other CPU.
- X
- XSystem V Release 2 (as exemplified by Microport System V/AT): At the
- Xend of the file "/etc/magic", add the following line:
- X
- X20 long 0xfdc4a7dc zoo archive
- X
- XThis should work on a little-endian machine, in which the long value
- X0xfdc4a7dc is stored with the least-significant byte first. For a big-
- Xendian machine, you will probably need to replace it with 0xdca7c4fd.
- XThis assumes that long occupies 4 bytes. If not, use a data type name
- Xthat is exactly 4 bytes.
- X
- X=====
- XChanges needed to make the 4.3BSD "file" command recognize zoo
- Xarchives. Known to work on a VAX-11/785.
- X
- X*** file.c.old Thu Mar 6 19:34:29 1986
- X--- file.c Sat Feb 21 19:28:52 1987
- X***************
- X*** 172,181 ****
- X--- 172,187 ----
- X case 070707:
- X printf("cpio data\n");
- X return;
- X }
- X
- X+ if (buf[20] == (char) 0xdc && buf[21] == (char) 0xa7 &&
- X+ buf[22] == (char) 0xc4 && buf[23] == (char) 0xfd) {
- X+ printf ("zoo archive\n");
- X+ return;
- X+ }
- X+
- X if (buf[0] == '#' && buf[1] == '!' && shellscript(buf+2, &mbuf))
- X return;
- X if (buf[0] == '\037' && buf[1] == '\235') {
- X if (buf[2]&0x80)
- X printf("block ");
- END_OF_FILE
- if test 1814 -ne `wc -c <'file.fix'`; then
- echo shar: \"'file.fix'\" unpacked with wrong size!
- fi
- # end of 'file.fix'
- fi
- if test -f 'lzconst.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'lzconst.h'\"
- else
- echo shar: Extracting \"'lzconst.h'\" \(574 characters\)
- sed "s/^X//" >'lzconst.h' <<'END_OF_FILE'
- X/* @(#) lzconst.h 2.1 87/12/25 12:22:30 */
- X
- X/*
- XThe contents of this file are hereby released to the public domain.
- X
- X -- Rahul Dhesi 1986/12/31
- X*/
- X
- X#define INBUFSIZ (IN_BUF_SIZE - 10) /* avoid obo errors */
- X#define OUTBUFSIZ (OUT_BUF_SIZE - 10)
- X#define MEMERR 2
- X#define IOERR 1
- X#define MAXBITS 13
- X#define CLEAR 256 /* clear code */
- X#define Z_EOF 257 /* end of file marker */
- X#define FIRST_FREE 258 /* first free code */
- X#define MAXMAX 8192 /* max code + 1 */
- END_OF_FILE
- if test 574 -ne `wc -c <'lzconst.h'`; then
- echo shar: \"'lzconst.h'\" unpacked with wrong size!
- fi
- # end of 'lzconst.h'
- fi
- if test -f 'machine.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'machine.c'\"
- else
- echo shar: Extracting \"'machine.c'\" \(1142 characters\)
- sed "s/^X//" >'machine.c' <<'END_OF_FILE'
- X#ifndef LINT
- X/* @(#) machine.c 2.3 88/01/02 01:21:44 */
- Xstatic char sccsid[]="@(#) machine.c 2.3 88/01/02 01:21:44";
- X#endif /* LINT */
- X
- X/*
- XThe contents of this file are hereby released to the public domain.
- X
- X -- Rahul Dhesi 1986/12/31
- X*/
- X
- X#include "options.h"
- X#include "zooio.h"
- X#include "zoo.h"
- X#include "zoofns.h"
- X#include "various.h"
- X
- X#ifdef UNBUF_IO
- Xint write PARMS ((int, VOIDPTR, unsigned));
- X
- X/*
- Xblockwrite() is like write() except that it ignores all
- Xoutput to file descriptor -2, which stands for the null file.
- X*/
- Xint blockwrite (fd, buf, count)
- Xint fd;
- X#ifdef VOIDPTR
- XVOIDPTR buf;
- X#else
- Xchar *buf;
- X#endif /* VOIDPTR */
- Xunsigned count;
- X{
- X if (fd == -2)
- X return (count);
- X else
- X return (write (fd, buf, count));
- X}
- X#endif
- X
- X#ifdef SYS_V
- X#include "sysv.c"
- X#endif
- X
- X#ifdef GENERIC
- X#include "generic.c"
- X#endif
- X
- X#ifdef BSD4_3
- X#include "bsd.c"
- X#endif
- X
- X#ifdef DLC
- X#include "generic.c"
- X#endif
- X
- X#ifdef VMS
- X#include "vms.c"
- X#endif
- X
- X#ifdef MSC
- X#ifdef PORTABLE
- X#include "generic.c"
- X#else
- X#include "msc.c"
- X#endif
- X#endif
- X
- X#ifdef TURBOC
- X#ifdef PORTABLE
- X#include "generic.c"
- X#else
- X#include "turboc.c"
- X#endif
- X#endif
- END_OF_FILE
- if test 1142 -ne `wc -c <'machine.c'`; then
- echo shar: \"'machine.c'\" unpacked with wrong size!
- fi
- # end of 'machine.c'
- fi
- if test -f 'machine.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'machine.h'\"
- else
- echo shar: Extracting \"'machine.h'\" \(1069 characters\)
- sed "s/^X//" >'machine.h' <<'END_OF_FILE'
- X/* @(#) machine.h 2.1 87/12/25 12:22:43 */
- X
- X/*
- XThe contents of this file are hereby released to the public domain.
- X
- X -- Rahul Dhesi 1986/11/14
- X*/
- X
- X/*
- XThis file holds definitions that usually do not change
- Xbetween different systems, except when using REALLY strange systems. But
- Xoptions.h and machine.c hold stuff that does change quite a bit.
- X*/
- X
- X/*
- XMAXLONG is the maximum size of a long integer. Right now it doesn't have to
- Xbe accurate since it's only used within zooext() to fake infinite disk space.
- X*/
- X#define MAXLONG ((unsigned long) (~0L))
- X
- X/*
- XType BYTE must hold exactly 8 bits. The code will collapse badly if BYTE is
- Xanything other than exactly 8 bits. To avoid sign extension when casting
- XBYTE to a longer size, it must be declared unsigned. For machine-
- Xindependence, Zoo does all I/O of archive headers and directory entries
- Xin units of BYTE. The actual file data are not written in units of
- XBYTE, however, so portability may not be absolute.
- X*/
- Xtypedef unsigned char BYTE; /* type corresponding to an 8-bit byte */
- X
- END_OF_FILE
- if test 1069 -ne `wc -c <'machine.h'`; then
- echo shar: \"'machine.h'\" unpacked with wrong size!
- fi
- # end of 'machine.h'
- fi
- if test -f 'mkbsd' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'mkbsd'\"
- else
- echo shar: Extracting \"'mkbsd'\" \(167 characters\)
- sed "s/^X//" >'mkbsd' <<'END_OF_FILE'
- X# @(#) mkbsd 2.2 88/08/15 15:41:34
- X#4.3BSD -- make Zoo and Fiz
- Xmake "cswitch=-c -O -DBSD4_3" "ldswitch=-o zoo" zoo
- Xmake "cswitch=-c -O -DBSD4_3" "ldswitch=-o fiz" fiz
- END_OF_FILE
- if test 167 -ne `wc -c <'mkbsd'`; then
- echo shar: \"'mkbsd'\" unpacked with wrong size!
- fi
- # end of 'mkbsd'
- fi
- if test -f 'mksysv' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'mksysv'\"
- else
- echo shar: Extracting \"'mksysv'\" \(154 characters\)
- sed "s/^X//" >'mksysv' <<'END_OF_FILE'
- X# @(#) mksysv 2.1 87/12/25 12:23:16
- X#System V
- Xmake "cswitch=-c -O -DSYS_V" "ldswitch=-s -o zoo" zoo
- Xmake "cswitch=-c -O -DSYS_V" "ldswitch=-s -o fiz" fiz
- END_OF_FILE
- if test 154 -ne `wc -c <'mksysv'`; then
- echo shar: \"'mksysv'\" unpacked with wrong size!
- fi
- # end of 'mksysv'
- fi
- if test -f 'mksysvsh' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'mksysvsh'\"
- else
- echo shar: Extracting \"'mksysvsh'\" \(355 characters\)
- sed "s/^X//" >'mksysvsh' <<'END_OF_FILE'
- X# @(#) mksysvsh 2.1 87/12/25 12:23:19
- X#This script first calls `mksysvsh' to build zoo and fiz without
- X#the shared libraries. Then it deletes zoo and fiz and reloads
- X#them with the shared libraries.
- Xsh mksysv
- X/bin/rm -f zoo fiz
- Xmake CC=ld ldswitch="/lib/crt0s.o /lib/shlib.ifile -o zoo" zoo
- Xmake CC=ld ldswitch="/lib/crt0s.o /lib/shlib.ifile -o fiz" fiz
- END_OF_FILE
- if test 355 -ne `wc -c <'mksysvsh'`; then
- echo shar: \"'mksysvsh'\" unpacked with wrong size!
- fi
- # end of 'mksysvsh'
- fi
- if test -f 'mkuport' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'mkuport'\"
- else
- echo shar: Extracting \"'mkuport'\" \(205 characters\)
- sed "s/^X//" >'mkuport' <<'END_OF_FILE'
- X# @(#) mkuport 2.3 88/08/15 15:42:39
- X#Microport UNIX on AT. -Ml = large memory model.
- Xmake "cswitch=-O -c -Ml -DSYS_V" "ldswitch=-Ml -o zoo" zoo
- Xmake "cswitch=-O -c -Ml -DSYS_V" "ldswitch=-Ml -o fiz" fiz
- END_OF_FILE
- if test 205 -ne `wc -c <'mkuport'`; then
- echo shar: \"'mkuport'\" unpacked with wrong size!
- fi
- # end of 'mkuport'
- fi
- if test -f 'mkx68' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'mkx68'\"
- else
- echo shar: Extracting \"'mkx68'\" \(393 characters\)
- sed "s/^X//" >'mkx68' <<'END_OF_FILE'
- X# @(#) mkx68 2.1 87/12/25 12:23:27
- X#Radio Shack Model 16 with Xenix/68000 3.01.01. "-DM_VOID" tells not
- X#to try to do a typedef of `void'. "-Dvoid=int" because compiler doesn't
- X#know about `void'. `-s -n' strips and makes it shareable.
- Xmake "cswitch=-c -O -DSYS_V -DM_VOID -Dvoid=int" "ldswitch=-s -n -o zoo" zoo
- Xmake "cswitch=-c -O -DSYS_V -DM_VOID -Dvoid=int" "ldswitch=-s -n -o fiz" fiz
- END_OF_FILE
- if test 393 -ne `wc -c <'mkx68'`; then
- echo shar: \"'mkx68'\" unpacked with wrong size!
- fi
- # end of 'mkx68'
- fi
- if test -f 'mkx86' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'mkx86'\"
- else
- echo shar: Extracting \"'mkx86'\" \(425 characters\)
- sed "s/^X//" >'mkx86' <<'END_OF_FILE'
- X# @(#) mkx86 2.1 87/12/25 12:23:30
- X# Make Zoo and Fiz
- X# This script is believed to work on:
- X# Xenix 3.4 on Greg Laskin's Intel 310/286
- X# SCO Xenix 2.2 on Robert Cliff's AT.
- X#`-Ml' for large memory model, `-M2' to generate code for 80286 cpu,
- X#`-F 8000' for 0x8000 bytes of stack space
- Xmake "cswitch=-c -O -DSYS_V -Ml -M2" "ldswitch=-Ml -o zoo -F 8000" zoo
- Xmake "cswitch=-c -O -DSYS_V -Ml -M2" "ldswitch=-Ml -o fiz" fiz
- END_OF_FILE
- if test 425 -ne `wc -c <'mkx86'`; then
- echo shar: \"'mkx86'\" unpacked with wrong size!
- fi
- # end of 'mkx86'
- fi
- if test -f 'nixmode.i' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'nixmode.i'\"
- else
- echo shar: Extracting \"'nixmode.i'\" \(1127 characters\)
- sed "s/^X//" >'nixmode.i' <<'END_OF_FILE'
- X#ifndef LINT
- X/* @(#) nixmode.i 1.2 88/01/24 12:48:57 */
- Xstatic char modeid[]="@(#) nixmode.i 1.2 88/01/24 12:48:57";
- X#endif
- X
- X/*
- X(C) Copyright 1988 Rahul Dhesi -- All rights reserved
- X
- XUNIX-specific routines to get and set file attribute. These might be
- Xusable on other systems that have the following identical things:
- Xfileno(), fstat(), chmod(), sys/types.h and sys/stat.h.
- X*/
- X
- X/*
- XGet file attributes. Currently only the lowest nine of the
- X**IX mode bits are used. Also we return bit 23=0 and bit 22=1,
- Xwhich means use portable attribute format, and use attribute
- Xvalue instead of using default at extraction time.
- X*/
- X
- Xunsigned long getfattr (f)
- XZOOFILE f;
- X{
- X int fd;
- X struct stat buf; /* buffer to hold file information */
- X fd = fileno(f);
- X if (fstat (fd, &buf) == -1)
- X return (NO_FATTR); /* inaccessible -- no attributes */
- X else
- X return (unsigned long) (buf.st_mode & 0x1ffL) | (1L << 22);
- X}
- X
- X/*
- XSet file attributes. Only the lowest nine bits are used.
- X*/
- X
- Xint setfattr (f, a)
- Xchar *f; /* filename */
- Xunsigned long a; /* atributes to set */
- X{
- X return (chmod (f, (int) (a & 0x1ff)));
- X}
- END_OF_FILE
- if test 1127 -ne `wc -c <'nixmode.i'`; then
- echo shar: \"'nixmode.i'\" unpacked with wrong size!
- fi
- # end of 'nixmode.i'
- fi
- if test -f 'options.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'options.c'\"
- else
- echo shar: Extracting \"'options.c'\" \(1874 characters\)
- sed "s/^X//" >'options.c' <<'END_OF_FILE'
- X#ifndef LINT
- Xstatic char sccsid[]="@(#) options.c 2.1 87/12/25 12:23:56";
- X#endif /* LINT */
- X
- X/*
- XCopyright (C) 1986, 1987 Rahul Dhesi -- All rights reserved
- X*/
- X/*
- XHere we define routines specific to only a few systems. Routines are
- Xselected based on defined symbols. Routines specific to only one
- Xsystem are in machine.c for the appropriate system.
- X*/
- X
- X#include "options.h"
- X#include "zooio.h"
- X#include "various.h"
- X#include "zoo.h"
- X#include "zoofns.h"
- X#include "errors.i"
- X
- X#ifdef REN_LINK
- X/* rename using link() followed by unlink() */
- X/*
- XThe following code assumes that if unlink() returns nonzero, then the
- Xattempt to unlink failed. If unlink() ever returns nonzero after actually
- Xunlinking the file, then the file being renamed will be lost!!! Test this
- Xthoroughly. It is assumed that link() and unlink() return zero if no
- Xerror else nonzero.
- X*/
- Xint chname (newname, oldname)
- Xchar *newname, *oldname;
- X{
- X int status;
- X if (link (oldname, newname) == 0) { /* if we can create new name */
- X status = unlink (oldname); /* unlink old one */
- X if (status != 0) { /* if unlink of old name failed */
- X unlink (newname); /* cancel new link */
- X return (-1); /* return error */
- X } else
- X return (0);
- X }
- X else /* couldn't create new link */
- X return (-1);
- X}
- X#else
- X/* else not REN_LINK */
- X
- Xint chname (newname, oldname)
- Xchar *newname, *oldname;
- X{
- X#ifdef REN_NORM
- X if (rename(newname, oldname) != 0) /* normal order */
- X#else
- X if (rename(oldname, newname) != 0) /* reverse order */
- X#endif
- X return (-1);
- X else
- X return (0);
- X}
- X#endif /* end of not REN_LINK */
- X
- X/*
- XStandard exit handler; not used if specific system defines its
- Xown.
- X*/
- X#ifndef SPECEXIT
- Xint zooexit (status)
- Xint status;
- X{
- X exit (status);
- X}
- X#endif
- END_OF_FILE
- if test 1874 -ne `wc -c <'options.c'`; then
- echo shar: \"'options.c'\" unpacked with wrong size!
- fi
- # end of 'options.c'
- fi
- if test -f 'options.opt' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'options.opt'\"
- else
- echo shar: Extracting \"'options.opt'\" \(28 characters\)
- sed "s/^X//" >'options.opt' <<'END_OF_FILE'
- Xsys$share:vaxcrtl.exe/share
- END_OF_FILE
- if test 28 -ne `wc -c <'options.opt'`; then
- echo shar: \"'options.opt'\" unpacked with wrong size!
- fi
- # end of 'options.opt'
- fi
- if test -f 'parse.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'parse.h'\"
- else
- echo shar: Extracting \"'parse.h'\" \(704 characters\)
- sed "s/^X//" >'parse.h' <<'END_OF_FILE'
- X/* @(#) parse.h 2.1 87/12/25 12:24:15 */
- X
- X/*
- XThe contents of this file are hereby released to the public domain.
- X
- X -- Rahul Dhesi 1986/11/14
- X*/
- X
- X/*
- Xdefines structure used in call to parse()
- X*/
- X#define XTRA 2 /* extra space to avoid off-by-one errors */
- X
- X
- Xstruct path_st {
- X char drive[2+1+XTRA]; /* drive name */
- X char dir[PATHSIZE+1+XTRA]; /* path prefix */
- X char fname[8+1+XTRA]; /* root name of filename */
- X char lfname[LFNAMESIZE+1+XTRA]; /* long filename */
- X char ext[EXTLEN+1+XTRA]; /* extension */
- X};
- X
- X#ifdef LINT_ARGS
- Xvoid parse (struct path_st *, char *);
- X#else
- Xvoid parse();
- X#endif
- END_OF_FILE
- if test 704 -ne `wc -c <'parse.h'`; then
- echo shar: \"'parse.h'\" unpacked with wrong size!
- fi
- # end of 'parse.h'
- fi
- if test -f 'portable.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'portable.h'\"
- else
- echo shar: Extracting \"'portable.h'\" \(2544 characters\)
- sed "s/^X//" >'portable.h' <<'END_OF_FILE'
- X/* @(#) portable.h 2.3 87/12/26 12:25:49 */
- X/* @(#) portable.h 2.4 88/08/24 00:56:43 */
- X
- X/* Definitions for portable I/O
- X
- XThe contents of this file are hereby released to the public domain.
- X
- X -- Rahul Dhesi 1986/11/14
- X
- X
- X
- X DEFINITIONS IN THIS FILE
- X
- XSymbols:
- X
- XZ_WRITE, Z_READ, and Z_RDWR are the parameters to supply to zooopen()
- Xand to open an existing file for write, read, and read-write
- Xrespectively. Z_NEW is the parameter to supply to zoocreate() to
- Xopen an existing file or create a new file for write and read. The
- Xfile must be opened in binary format, with no newline translation of
- Xany kind.
- X
- XMacros or functions:
- X
- Xzgetc(x) reads a character from ZOOFILE x.
- Xzputchar(c) writes a character c to standard output.
- XMKDIR(x) creates a directory x.
- X*/
- X
- X/* Borland's Turbo C. */
- X#ifdef TURBOC
- X/* options for zooopen(), zoocreate() */
- X#define Z_WRITE "r+b"
- X#define Z_READ "rb"
- X#define Z_RDWR "r+b"
- X#define Z_NEW "w+b"
- X#define zgetc(x) getc(x)
- X#define zputchar(c) putchar(c)
- X#define MKDIR(x) mkdir(x)
- Xint mkdir (char *);
- X#endif
- X
- X/* Microsoft C 3.0 */
- X#ifdef MSC
- X/* options for zooopen(), zoocreate() */
- X#define Z_WRITE "r+b"
- X#define Z_READ "rb"
- X#define Z_RDWR "r+b"
- X#define Z_NEW "w+b"
- X#define zgetc(x) getc(x)
- X#define zputchar(c) putchar(c)
- X#define MKDIR(x) mkdir(x)
- Xint mkdir (char *);
- X#endif
- X
- X#ifdef VMS
- X#define Z_WRITE "r+"
- X#define Z_READ "r"
- X#define Z_RDWR "r+"
- X#define Z_NEW "w+b"
- X#define zgetc(x) getc(x)
- X#define zputchar(c) putchar(c)
- X#define MKDIR(x) vmsmkdir (x, 0)
- X#endif
- X
- X/* Datalight C. */
- X#ifdef DLC
- X#endif
- X
- X
- X#ifdef GENERIC
- X/* **IX I/O, but MKDIR() is a no-operation */
- X#define NIX_IO /* standard **IX I/O */
- X#define MKDIR(x)
- X#endif
- X
- X/* **IX System V release 2.1 */
- X#ifdef SYS_V
- X#define NIX_IO /* standard **IX I/O */
- X#define MKDIR(x) mkdir(x) /* define this in sysv.c */
- X#endif
- X
- X/* Xenix */
- X#ifdef XENIX
- X#define NIX_IO /* standard **IX I/O */
- X#endif
- X
- X/* 4.3BSD */
- X#ifdef BSD4_3
- X#define NIX_IO /* standard **IX I/O */
- X#define MKDIR(x) mkdir(x, 0777)
- X#endif
- X
- X/* Amiga */
- X#ifdef MCH_AMIGA
- X#define MKDIR(x) /* something is needed here */
- X#define NIX_IO
- X#endif
- X
- X/* Standard **IX I/O definitions */
- X#ifdef NIX_IO
- X/* options for zooopen(), zoocreate() */
- X#define Z_WRITE "r+"
- X#define Z_READ "r"
- X#define Z_RDWR "r+"
- X#define Z_NEW "w+"
- X#define zgetc(x) getc(x)
- X#define zputchar(c) putchar(c)
- X#endif /* NIX_IO */
- END_OF_FILE
- if test 2544 -ne `wc -c <'portable.h'`; then
- echo shar: \"'portable.h'\" unpacked with wrong size!
- fi
- # end of 'portable.h'
- fi
- if test -f 'readme.too' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'readme.too'\"
- else
- echo shar: Extracting \"'readme.too'\" \(716 characters\)
- sed "s/^X//" >'readme.too' <<'END_OF_FILE'
- XThis is an experiment in off-beat job-hunting techniques.
- X
- XWhat sort of software development opportunities are out there? I'm
- Xlooking for a change from the academic life. I'm willing to relocate.
- XI have familiarity with programming and system administration in a
- XUNIX-based environment, know about configuration control, and have
- Xtaught and am teaching courses in several areas including operating
- Xsystems, programming languages, and software engineering. More
- Xinformation (and a formal resume listing degrees too numerous to
- Xmention here) is available upon request.
- X
- XPeople here know I'm considering a change.
- X
- X Rahul Dhesi
- X 1988/09/12
- END_OF_FILE
- if test 716 -ne `wc -c <'readme.too'`; then
- echo shar: \"'readme.too'\" unpacked with wrong size!
- fi
- # end of 'readme.too'
- fi
- if test -f 'sysv.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'sysv.c'\"
- else
- echo shar: Extracting \"'sysv.c'\" \(2570 characters\)
- sed "s/^X//" >'sysv.c' <<'END_OF_FILE'
- X#ifndef LINT
- X/* @(#) sysv.c 2.5 88/01/10 14:47:24 */
- Xstatic char sysvid[]="@(#) sysv.c 2.5 88/01/10 14:47:24";
- X#endif /* LINT */
- X
- X/* machine.c for System V */
- X
- X/*
- XThe contents of this file are hereby released to the public domain.
- X
- X -- Rahul Dhesi 1986/12/31
- X*/
- X
- X#ifdef UNBUF_IO
- X/*
- XFunction tell() returns the current seek position for a file
- Xdescriptor. Microport System V/AT has an undocumented tell()
- Xlibrary function (why?) but the UNIX PC doesn't, so we code
- Xone here. It is needed for unbuffered I/O only.
- X*/
- Xlong lseek PARMS ((int, long, int));
- Xlong tell (fd)
- Xint fd;
- X{ return (lseek (fd, 0L, 1)); }
- X#endif
- X
- X/****************
- XDate and time functions are standard UNIX-style functions. "nixtime.i"
- Xwill be included by machine.c.
- X*/
- X
- X#include <sys/types.h>
- X#include <sys/stat.h>
- X#include <time.h>
- X
- X/* Function isadir() returns 1 if the supplied handle is a directory,
- Xelse it returns 0.
- X*/
- X
- Xint isadir (file)
- XZOOFILE file;
- X{
- X int handle = fileno(file);
- X struct stat buf; /* buffer to hold file information */
- X if (fstat (handle, &buf) == -1) {
- X return (0); /* inaccessible -- assume not dir */
- X } else {
- X if (buf.st_mode & S_IFDIR)
- X return (1);
- X else
- X return (0);
- X }
- X}
- X
- X/****************
- XFunction fixfname() converts the supplied filename to a syntax
- Xlegal for the host system. It is used during extraction.
- X*/
- X
- Xchar *fixfname(fname)
- Xchar *fname;
- X{
- X return (fname); /* default is no-op */
- X}
- X
- Xextern long timezone; /* defined by library routine */
- Xlong time ();
- Xstruct tm *localtime ();
- X
- X/* Function gettz(), returns the offset from GMT in seconds of the
- Xlocal time, taking into account daylight savings time */
- Xlong gettz()
- X{
- X struct tm *tm;
- X long clock;
- X clock = time ((long *) 0);
- X tm = localtime (&clock);
- X return (timezone - tm->tm_isdst*3600);
- X}
- X
- X/* Standard UNIX-compatible time functions */
- X#include "nixtime.i"
- X
- X/* Standard UNIX-specific file attribute routines */
- X#include "nixmode.i"
- X
- X/*
- XMake a directory. System V has no system call accessible to
- Xordinary users to make a new directory. Hence we spawn a shell
- Xand hope /bin/mkdir is there. Since /bin/mkdir gives a nasty
- Xerror message if it fails, we call it only if nothing already
- Xexists by the name of the needed directory.
- X*/
- X
- Xint mkdir(dirname)
- Xchar *dirname;
- X{
- X char cmd[PATHSIZE+11+1]; /* room for "/bin/mkdir " used below + 1 spare */
- X if (!exists(dirname)) {
- X strcpy(cmd, "/bin/mkdir ");
- X strcat(cmd, dirname);
- X return (system(cmd));
- X }
- X return (0);
- X}
- END_OF_FILE
- if test 2570 -ne `wc -c <'sysv.c'`; then
- echo shar: \"'sysv.c'\" unpacked with wrong size!
- fi
- # end of 'sysv.c'
- fi
- if test -f 'various.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'various.h'\"
- else
- echo shar: Extracting \"'various.h'\" \(2447 characters\)
- sed "s/^X//" >'various.h' <<'END_OF_FILE'
- X/* @(#) various.h 2.3 87/12/27 14:44:34 */
- X
- X/*
- XThe contents of this file are hereby released to the public domain.
- X
- X -- Rahul Dhesi 1986/11/14
- X*/
- X
- X/*
- XThis files gives definitions for most external functions used by Zoo.
- XIf LINT_ARGS is defined, ANSI-style function prototypes are used, else
- Xnormal K&R function declarations are used.
- X
- XNote: Always precede this file with an include of stdio.h because it uses
- Xthe predefined type FILE.
- X
- XMicrosoft C and Turbo C use different conventions for specifying an
- Xincomplete argument list in a function prototype. Microsoft C uses a
- Xtrailing comma, while Turbo C uses three dots (...). To take care
- Xof these peculiarities, the symbol MORE stands for incomplete arguments.
- XFor Turbo C we define it to be three dots and for Microsoft C we
- Xdefine it to be nothing. This is done in options.h, so options.h must
- Xalways be included before various.h is included.
- X*/
- X
- X#ifndef PARMS
- X#ifdef LINT_ARGS
- X#define PARMS(x) x
- X#else
- X#define PARMS(x) ()
- X#endif
- X#endif
- X
- XFILE *fdopen PARMS ((int, char *));
- XFILE *fopen PARMS ((char *, char *));
- Xchar *fgets PARMS ((char *, int, FILE *));
- Xchar *gets PARMS ((char *));
- Xchar *malloc PARMS ((unsigned int));
- Xchar *realloc PARMS ((char *, unsigned int));
- Xchar *strcat PARMS ((char *, char *));
- Xchar *strchr PARMS ((char *, int));
- Xchar *strcpy PARMS ((char *, char *));
- Xchar *strdup PARMS ((char *));
- Xchar *strlwr PARMS ((char *));
- Xchar *strncat PARMS ((char *, char *, unsigned int));
- Xchar *strncpy PARMS ((char *, char *, unsigned int));
- Xchar *strrchr PARMS ((char *, int));
- Xint fclose PARMS ((FILE *));
- Xint fflush PARMS ((FILE *));
- Xint fgetc PARMS ((FILE *));
- Xint fgetchar PARMS (());
- Xint fprintf PARMS ((FILE *, char *, MORE));
- Xint fputchar PARMS ((int));
- Xint fputs PARMS ((char *, FILE *));
- X
- X#ifdef ALWAYS_INT
- Xint fputc PARMS ((int, FILE *));
- Xint fread PARMS ((VOIDPTR, int, int, FILE *));
- Xint fwrite PARMS ((VOIDPTR, int, int, FILE *));
- X#else
- Xint fputc PARMS ((char, FILE *));
- Xint fread PARMS ((VOIDPTR, unsigned, unsigned, FILE *));
- Xint fwrite PARMS ((VOIDPTR, unsigned, unsigned, FILE *));
- X#endif /* ALWAYS_INT */
- X
- Xint fseek PARMS ((FILE *, long, int));
- Xint printf PARMS ((char *, MORE));
- Xint rename PARMS ((char *, char *));
- Xint setmode PARMS ((int, int));
- Xint strcmp PARMS ((char *, char *));
- Xint strncmp PARMS ((char *, char *, unsigned int));
- Xint unlink PARMS ((char *));
- Xlong ftell PARMS ((FILE *));
- Xunsigned int strlen PARMS ((char *));
- END_OF_FILE
- if test 2447 -ne `wc -c <'various.h'`; then
- echo shar: \"'various.h'\" unpacked with wrong size!
- fi
- # end of 'various.h'
- fi
- if test -f 'version.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'version.c'\"
- else
- echo shar: Extracting \"'version.c'\" \(101 characters\)
- sed "s/^X//" >'version.c' <<'END_OF_FILE'
- X/* @(#) version.c 2.9 1988/08/25 12:43:57 */
- Xchar version[] = "Version 2.01 (1988/08/25 12:43:57)";
- END_OF_FILE
- if test 101 -ne `wc -c <'version.c'`; then
- echo shar: \"'version.c'\" unpacked with wrong size!
- fi
- # end of 'version.c'
- fi
- if test -f 'zoofilt.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'zoofilt.c'\"
- else
- echo shar: Extracting \"'zoofilt.c'\" \(1861 characters\)
- sed "s/^X//" >'zoofilt.c' <<'END_OF_FILE'
- X/* @(#) zoofilt.c 1.8 88/01/30 23:47:05 */
- X
- X#ifndef LINT
- Xstatic char sccsid[]="@(#) zoofilt.c 1.8 88/01/30 23:47:05";
- X#endif
- X
- X/*
- X(C) Copyright 1988 Rahul Dhesi -- All rights reserved
- X
- XFilter mode -- compress or decompress standard input and write
- Xto standard output.
- X*/
- X
- X#include "options.h"
- X
- X#ifdef FILTER
- X
- X#include "zooio.h"
- X#include "errors.i"
- X
- X/* action */
- X#define COMPRESS 0
- X#define UNCOMPRESS 1
- X
- X#define FTAG ((unsigned int) 0x5a32) /* magic number */
- X
- Xextern unsigned int crccode;
- X
- X#ifdef LINT_ARGS
- Xint rdint(unsigned int *); /* read an unsigned int */
- Xint wrint(unsigned int); /* write an unsigned int */
- X#else
- Xint rdint();
- Xint wrint();
- X#endif /* LINT_ARGS */
- X
- X/* global variable used to pass two bytes (CRC value) back from lzd to here */
- Xunsigned int filt_lzd_word;
- X
- Xvoid zoofilt (option)
- Xchar *option;
- X{
- X int choice; /* what to do -- [de]compress */
- X unsigned int filetag; /* tag stored in input */
- X int stat1, stat2, stat3; /* status codes */
- X
- X switch (*++option) {
- X case 'c': choice = COMPRESS; break;
- X case 'u': choice = UNCOMPRESS; break;
- X default:
- X prterror ('f', inv_option, *option); /* fatal error -- abort */
- X }
- X
- X crccode = 0; /* needed whether compressing or uncompressing */
- X
- X switch (choice) {
- X case COMPRESS:
- X stat1 = wrint (FTAG);
- X stat2 = lzc (STDIN, STDOUT);
- X stat3 = wrint (crccode);
- X if (stat1 == 0 && stat2 == 0 && stat3 == 0)
- X zooexit (0);
- X else {
- X fprintf (stderr, "Zoo: FATAL: Compression error.\n");
- X zooexit (1);
- X }
- X break;
- X case UNCOMPRESS:
- X stat1 = rdint (&filetag);
- X if (stat1 != 0 || filetag != FTAG)
- X zooexit (1);
- X stat2 = lzd (STDIN, STDOUT);
- X if (stat2 == 0 && filt_lzd_word == crccode)
- X zooexit (0);
- X else {
- X fprintf (stderr, "Zoo: FATAL: Uncompression error.\n");
- X zooexit (1);
- X }
- X break;
- X }
- X} /* zoofilt */
- X
- X#endif /* FILTER */
- END_OF_FILE
- if test 1861 -ne `wc -c <'zoofilt.c'`; then
- echo shar: \"'zoofilt.c'\" unpacked with wrong size!
- fi
- # end of 'zoofilt.c'
- fi
- echo shar: End of archive 1 \(of 10\).
- cp /dev/null ark1isdone
- MISSING=""
- for I in 1 2 3 4 5 6 7 8 9 10 ; do
- if test ! -f ark${I}isdone ; then
- MISSING="${MISSING} ${I}"
- fi
- done
- if test "${MISSING}" = "" ; then
- echo You have unpacked all 10 archives.
- rm -f ark[1-9]isdone ark[1-9][0-9]isdone
- else
- echo You still need to unpack the following archives:
- echo " " ${MISSING}
- fi
- ## End of shell archive.
- exit 0
-